extends BaseDlg

onready var file = File.new()
# Called when the node enters the scene tree for the first time.
var utils = null

var modDic = {}

func init():
	if not sys.has_node("VEBase"):
		var base = load(data.infoDs["VEBase"]["VEBase"].dir).new()
		base.name = "VEBase"
		sys.add_child(base)
	
	utils = sys.get_node("VEBase").utils
	var first = true
	for i in data.getList("modSetting"):
		var ins = load(i.dir).new()
		if ins.get("modName") == null or not ins.has_method("initModSetting"):continue
		
		var btn = utils.createItemButton($nameSpace/box, self, ins.get("modName"), "onModSel", [i.id])
		
		var content = utils.createScrollContainer($context)
		content.name = ins.get("modName")
		content.hide()
		if first:
			btn.pressed = true
			first = false
			content.show()
			$RichTextLabel.bbcode_text = "Mod名称：%s"%[ins.get("modName")]

		modDic[i.id] = content
		ins.initModSetting(content)

	
func onModSel(id):
	for i in $context.get_children():
		i.hide()
	modDic[id].show()
	$RichTextLabel.bbcode_text = "Mod名称：%s"%[modDic[id].name]
